/ Assembly List / LJCAddressParserLib / StandardAddress / ParsePostDirectional

Namespace - LJCAddressParserLib


Parameters
currentToken - The token value.
currentIndex - The token index value.

Returns

true if the token is a Postdirectional; otherwise, false.

Syntax

C#
public Boolean ParsePostDirectional(String currentToken, Int32& currentIndex)

Parses a token into the PostDirectional Property.

Remarks

Decrements currentIndex by one if the token is a PostDirectional.

The vertical bar indicates the Current Token Index.

Check current token for PostDirectional.
  If the token appears to be a PostDirectional.
    a. If The current token index is 1, then check if the first token(0) is an
       AddressNumber.
                   |
       Before: 123 South

       If it is an AddressNumber, then the current token must be the StreetName
       so do not use the current token as a PostDirectional.
     
       PostDirectional = null.
                  |
       After: 123 South
     
       The PostDirectional Parsing ends
     
    b. If the first token is not an AddressNumber, then it is considered a street name.
       Use the current token as a PostDirectional.
                    |
       Before: Main South

       PostDirectional = "S".
              |
       After: Main South
       
    c. If the current token index is greater than 1, then use the current token as
       a PostDirectional.
                              |
       Before: 123 Main South East
       
       PostDirectional = "E".
                       |
       After: 123 Main South East 
       
   Check for a Multi-word PostDirectional.

   If the following directional is "E", or "W" and the current directional is "N" or "S".
     a. If the current token index is 1, then check if the first token is an
        AddressNumber.

        If the first token is an AddressNumber, then the current token must
        be the StreetName, so do not create a combined PostDirectional.
                    |
        Before: 123 North East
        
        PostDirectional = "E".
                   |
        After: 123 North East

        The PostDirectional parsing ends.

     b. If the first token is not an AddressNumber, then it is considered a
        StreetName.
                     |
        Before: Main North East

        Create the two character PostDirectional and decrement the current
        token index by 1.
        
        PostDirectional = "NE".
               |
        After: Main North East
        
     c. If the current token index is greater than 1, then use the current token
        as a PostDirectional.
                         |
        Before: 123 Main North East
        
        Create the two character PostDirectional and decrement the current
        token index by 1.
        
        PostDirectional = "NE".
                   |
        After: 123 Main North East
        

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.